<?php
/**
 * 处理用户提交的代码
 *
 * @todo
 * @author Judas <judasnow@gmail.com>
 * @license http://www.opensource.org/licenses/lgpl-license.php LGPL
 */
session_start();
require_once('path.php');
require_once( SOJ_ROOT.'/include/function/lib.php');

@$request = $_POST;

try{
	
	$db = db_connect();
	$code_process = new code_process( $db , $request );
	$code_process->save();

	$code_file_name = $code_process->get_code_file_name();
	
	//@todo 封装到类之中
	$_SESSION['success_message'] = "save you code ok." ;
	$_SESSION['url'] = "../code/do_code_judge.php?code_file_name=$code_file_name" ;
	$_SESSION['url_descript'] = "do jodge now?" ;
	header('Location: ../message_handle/success_handle.php');
	exit ;

}catch(Exception $e){

	exception_handle( $e );
}
